/*
 * This file is part of TradeHelper library.
 *
 * TradeHelper library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TradeHelper library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TradeHelper library.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.rag.core;

import com.rag.forum.TradeHelper;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import javax.swing.*;

/**
 * User: mgarin Date: 10.04.12 Time: 16:04
 */

@XStreamAlias( "TrackerPage" )
public enum TrackerPage
{
    news,
    sell,
    buy,
    trade,
    rent,
    cards,
    favorites,
    newTopic,
    database,
    settings;

    public ImageIcon getIcon ()
    {
        return new ImageIcon ( TradeHelper.class.getResource ( "icons/menu/" + this + ".png" ) );
    }

    public String getText ()
    {
        if ( this.equals ( news ) )
        {
            return "Новости";
        }
        else if ( this.equals ( sell ) )
        {
            return "Продажа";
        }
        else if ( this.equals ( buy ) )
        {
            return "Покупка";
        }
        else if ( this.equals ( trade ) )
        {
            return "Обмен";
        }
        else if ( this.equals ( rent ) )
        {
            return "Аренда";
        }
        else if ( this.equals ( cards ) )
        {
            return "Карточки";
        }
        else if ( this.equals ( favorites ) )
        {
            return "Избранное";
        }
        else if ( this.equals ( newTopic ) )
        {
            return "Новый топик";
        }
        else if ( this.equals ( database ) )
        {
            return "База знаний";
        }
        else if ( this.equals ( settings ) )
        {
            return "Настройки";
        }
        else
        {
            return null;
        }
    }

    public boolean isActive ()
    {
        return !this.equals ( trade ) && !this.equals ( rent ) && !this.equals ( cards ) &&
                !this.equals ( newTopic );
    }
}
